import 'package:flutter/material.dart';

class TabView extends StatefulWidget {
  @override
  _TabViewState createState() => _TabViewState();
}

class _TabViewState extends State<TabView> {
  bool isShow = true;

  int ids = 1;

  List<Map> str = [
    {"id": 1, "name": "test1"},
    {"id": 2, "name": "test2"},
  ];

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        SizedBox(
          height: 50,
        ),
        Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: str
              .map(
                (e) => InkWell(
              onTap: () {
                print(e);
                setState(() {
                  ids = e["id"];
                });
              },
              child: Container(
                alignment: Alignment.center,
                width: 100,
                height: 40,
                //color: Colors.orange,
                margin: EdgeInsets.only(left: 10),
                child: Text(
                  e['name'],
                  style: TextStyle(
                      color: ids == e["id"] ? Colors.blue : Colors.white),
                ),
              ),
            ),
          )
              .toList(),
        ),
        ids==1? Container(
          width: 200,
          height: 200,
          color: Colors.green,
          alignment: Alignment.center,
          child: Text("" + ids.toString()),
        ):Container(
          width: 200,
          height: 200,
          color: Colors.yellow,
          alignment: Alignment.center,
          child: Text("" + ids.toString()),
        ),

      ],
    );
  }
}
